package com.wedo.mall.dialog;

import android.content.Context;
import android.widget.TextView;

import com.e.library.dialog.EDialog;
import com.wedo.mall.R;

import butterknife.BindView;
import butterknife.OnClick;

/**
 * Created by Lawrence on 2017/8/22.
 */

public class SimpleDialog extends EDialog {

    @BindView(R.id.tv_title) TextView tv_title;
    public OnEnsureListener listener;

    public static SimpleDialog with(Context context){
        return new SimpleDialog(context);
    }

    public SimpleDialog(Context context) {
        super(context);
    }

    @Override
    protected int layout() {
        return R.layout.dialog_simple;
    }

    @Override
    protected void onDialogCreated(Context context) {

    }

    public void setQuestion(String question){
        tv_title.setText(question);
    }

    @OnClick(R.id.ll_root)
    protected void onRootClick(){
        dismiss();
    }

    @OnClick(R.id.btn_cancel)
    protected void onCancelClick(){
        dismiss();
    }

    @OnClick(R.id.btn_ensure)
    protected void onEnsureClick(){
        if(listener !=null) {
            listener.onEnsure();
        }
        dismiss();
    }

    public interface OnEnsureListener{
        void onEnsure();
    }
}
